package com.ruoyi.web.controller.pv;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pv.domain.PvBookingTimeInfo;
import com.ruoyi.pv.service.IPvBookingTimeInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 预约时段详情列表Controller
 *
 * @author zzx
 * @date 2023-03-12
 */
@Api("预约时段详情")
@RestController
@RequestMapping("/pv/booking_time_info")
public class PvBookingTimeInfoController extends BaseController {
    @Autowired
    private IPvBookingTimeInfoService pvBookingTimeInfoService;

    /**
     * 查询预约时段详情列表列表
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:list')")
    @GetMapping("/list")
    @ApiOperation("查询预约时段详情列表列表")
    public TableDataInfo list(PvBookingTimeInfo pvBookingTimeInfo) {
        startPage();
        List<PvBookingTimeInfo> list = pvBookingTimeInfoService.selectPvBookingTimeInfoList(pvBookingTimeInfo);
        return getDataTable(list);
    }

    /**
     * 导出预约时段详情列表列表
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:export')")
    @Log(title = "预约时段详情列表" , businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PvBookingTimeInfo pvBookingTimeInfo) {
        List<PvBookingTimeInfo> list = pvBookingTimeInfoService.selectPvBookingTimeInfoList(pvBookingTimeInfo);
        ExcelUtil<PvBookingTimeInfo> util = new ExcelUtil<PvBookingTimeInfo>(PvBookingTimeInfo.class);
        util.exportExcel(response, list, "预约时段详情列表数据");
    }

    /**
     * 获取预约时段详情列表详细信息
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取预约时段详情列表详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(pvBookingTimeInfoService.selectPvBookingTimeInfoById(id));
    }

    /**
     * 新增预约时段详情列表
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:add')")
    @Log(title = "预约时段详情列表" , businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增预约时段详情列表")
    public AjaxResult add(@RequestBody PvBookingTimeInfo pvBookingTimeInfo) {
        return toAjax(pvBookingTimeInfoService.insertPvBookingTimeInfo(pvBookingTimeInfo));
    }

    /**
     * 修改预约时段详情列表
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:edit')")
    @Log(title = "预约时段详情列表" , businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改预约时段详情列表")
    public AjaxResult edit(@RequestBody PvBookingTimeInfo pvBookingTimeInfo) {
        return toAjax(pvBookingTimeInfoService.updatePvBookingTimeInfo(pvBookingTimeInfo));
    }

    /**
     * 删除预约时段详情列表
     */
    @PreAuthorize("@ss.hasPermi('pv:booking_time_info:remove')")
    @Log(title = "预约时段详情列表" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除预约时段详情列表")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(pvBookingTimeInfoService.deletePvBookingTimeInfoByIds(ids));
    }
}
